package com.example.mvvmrxjavaokhttpretrofit.utils;



import java.util.WeakHashMap;

public class RdRequestHeadsParamsUtil {

    private final static String APPKEY = "";

    public static String getAppId() {
        return "";
    }

    private static String getAppKey(String timestamp) {
        String APPKEY = MD5Util.string2MD5("appId=" + getAppId()
                + "&appKey=" + RdRequestHeadsParamsUtil.APPKEY
                + "&timestamp=" + timestamp);
        return APPKEY.toUpperCase();
    }

    private static String getSignature(String timestamp) {
        return MD5Util.string2MD5("userId=" + ""
                + "&token=" + "" +
                "&timestamp=" + timestamp)
                .toUpperCase();
    }

    public static WeakHashMap getRequestHeadsParams() {
        WeakHashMap<String, Object> PARAMS = new WeakHashMap<>();
        String timestamp = String.valueOf(System.currentTimeMillis());
        //封装校验码
        PARAMS.put("timestamp", timestamp);
        PARAMS.put("appKey", getAppKey(timestamp));
        PARAMS.put("signature", getSignature(timestamp));
        PARAMS.put("appId", getAppId());
        PARAMS.put("userId", "");
        return PARAMS;
    }
}
